3.204 \(\int (a+b \sin (e+f x))^2 (g \tan (e+f x))^p \, dx\)

Optimal. Leaf size=186 \[ \frac{a^2 (g \tan (e+f x))^{p+1} \, _2F_1\left (1,\frac{p+1}{2};\frac{p+3}{2};-\tan ^2(e+f x)\right )}{f g (p+1)}+\frac{2 a b \sin (e+f x) \cos ^2(e+f x)^{\frac{p+1}{2}} (g \tan (e+f x))^{p+1} \, _2F_1\left (\frac{p+1}{2},\frac{p+2}{2};\frac{p+4}{2};\sin ^2(e+f x)\right )}{f g (p+2)}+\frac{b^2 (g \tan (e+f x))^{p+3} \, _2F_1\left (2,\frac{p+3}{2};\frac{p+5}{2};-\tan ^2(e+f x)\right )}{f g^3 (p+3)} \]

[Out]

(a^2*Hypergeometric2F1[1, (1 + p)/2, (3 + p)/2, -Tan[e + f*x]^2]*(g*Tan[e + f*x])^(1 + p))/(f*g*(1 + p)) + (2*
a*b*(Cos[e + f*x]^2)^((1 + p)/2)*Hypergeometric2F1[(1 + p)/2, (2 + p)/2, (4 + p)/2, Sin[e + f*x]^2]*Sin[e + f*
x]*(g*Tan[e + f*x])^(1 + p))/(f*g*(2 + p)) + (b^2*Hypergeometric2F1[2, (3 + p)/2, (5 + p)/2, -Tan[e + f*x]^2]*
(g*Tan[e + f*x])^(3 + p))/(f*g^3*(3 + p))

________________________________________________________________________________________

Rubi [A]  time = 0.242273, antiderivative size = 186, normalized size of antiderivative = 1., number of steps used = 8, number of rules used = 6, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.261, Rules used = {2722, 3476, 364, 2602, 2577, 2591} \[ \frac{a^2 (g \tan (e+f x))^{p+1} \, _2F_1\left (1,\frac{p+1}{2};\frac{p+3}{2};-\tan ^2(e+f x)\right )}{f g (p+1)}+\frac{2 a b \sin (e+f x) \cos ^2(e+f x)^{\frac{p+1}{2}} (g \tan (e+f x))^{p+1} \, _2F_1\left (\frac{p+1}{2},\frac{p+2}{2};\frac{p+4}{2};\sin ^2(e+f x)\right )}{f g (p+2)}+\frac{b^2 (g \tan (e+f x))^{p+3} \, _2F_1\left (2,\frac{p+3}{2};\frac{p+5}{2};-\tan ^2(e+f x)\right )}{f g^3 (p+3)} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sin[e + f*x])^2*(g*Tan[e + f*x])^p,x]

[Out]

(a^2*Hypergeometric2F1[1, (1 + p)/2, (3 + p)/2, -Tan[e + f*x]^2]*(g*Tan[e + f*x])^(1 + p))/(f*g*(1 + p)) + (2*
a*b*(Cos[e + f*x]^2)^((1 + p)/2)*Hypergeometric2F1[(1 + p)/2, (2 + p)/2, (4 + p)/2, Sin[e + f*x]^2]*Sin[e + f*
x]*(g*Tan[e + f*x])^(1 + p))/(f*g*(2 + p)) + (b^2*Hypergeometric2F1[2, (3 + p)/2, (5 + p)/2, -Tan[e + f*x]^2]*
(g*Tan[e + f*x])^(3 + p))/(f*g^3*(3 + p))

Rule 2722

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((g_.)*tan[(e_.) + (f_.)*(x_)])^(p_.), x_Symbol] :> Int[Expan
dIntegrand[(g*Tan[e + f*x])^p, (a + b*Sin[e + f*x])^m, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2
, 0] && IGtQ[m, 0]

Rule 3476

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Dist[b/d, Subst[Int[x^n/(b^2 + x^2), x], x, b*Tan[c + d
*x]], x] /; FreeQ[{b, c, d, n}, x] &&  !IntegerQ[n]

Rule 364

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[(a^p*(c*x)^(m + 1)*Hypergeometric2F1[-
p, (m + 1)/n, (m + 1)/n + 1, -((b*x^n)/a)])/(c*(m + 1)), x] /; FreeQ[{a, b, c, m, n, p}, x] &&  !IGtQ[p, 0] &&
 (ILtQ[p, 0] || GtQ[a, 0])

Rule 2602

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[(a*Cos[e + f
*x]^(n + 1)*(b*Tan[e + f*x])^(n + 1))/(b*(a*Sin[e + f*x])^(n + 1)), Int[(a*Sin[e + f*x])^(m + n)/Cos[e + f*x]^
n, x], x] /; FreeQ[{a, b, e, f, m, n}, x] &&  !IntegerQ[n]

Rule 2577

Int[(cos[(e_.) + (f_.)*(x_)]*(b_.))^(n_)*((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_), x_Symbol] :> Simp[(b^(2*IntPart
[(n - 1)/2] + 1)*(b*Cos[e + f*x])^(2*FracPart[(n - 1)/2])*(a*Sin[e + f*x])^(m + 1)*Hypergeometric2F1[(1 + m)/2
, (1 - n)/2, (3 + m)/2, Sin[e + f*x]^2])/(a*f*(m + 1)*(Cos[e + f*x]^2)^FracPart[(n - 1)/2]), x] /; FreeQ[{a, b
, e, f, m, n}, x]

Rule 2591

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> With[{ff = FreeFactors[Ta
n[e + f*x], x]}, Dist[(b*ff)/f, Subst[Int[(ff*x)^(m + n)/(b^2 + ff^2*x^2)^(m/2 + 1), x], x, (b*Tan[e + f*x])/f
f], x]] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2]

Rubi steps

\begin{align*} \int (a+b \sin (e+f x))^2 (g \tan (e+f x))^p \, dx &=\int \left (a^2 (g \tan (e+f x))^p+2 a b \sin (e+f x) (g \tan (e+f x))^p+b^2 \sin ^2(e+f x) (g \tan (e+f x))^p\right ) \, dx\\ &=a^2 \int (g \tan (e+f x))^p \, dx+(2 a b) \int \sin (e+f x) (g \tan (e+f x))^p \, dx+b^2 \int \sin ^2(e+f x) (g \tan (e+f x))^p \, dx\\ &=\frac{\left (a^2 g\right ) \operatorname{Subst}\left (\int \frac{x^p}{g^2+x^2} \, dx,x,g \tan (e+f x)\right )}{f}+\frac{\left (b^2 g\right ) \operatorname{Subst}\left (\int \frac{x^{2+p}}{\left (g^2+x^2\right )^2} \, dx,x,g \tan (e+f x)\right )}{f}+\frac{\left (2 a b \cos ^{1+p}(e+f x) \sin ^{-1-p}(e+f x) (g \tan (e+f x))^{1+p}\right ) \int \cos ^{-p}(e+f x) \sin ^{1+p}(e+f x) \, dx}{g}\\ &=\frac{a^2 \, _2F_1\left (1,\frac{1+p}{2};\frac{3+p}{2};-\tan ^2(e+f x)\right ) (g \tan (e+f x))^{1+p}}{f g (1+p)}+\frac{2 a b \cos ^2(e+f x)^{\frac{1+p}{2}} \, _2F_1\left (\frac{1+p}{2},\frac{2+p}{2};\frac{4+p}{2};\sin ^2(e+f x)\right ) \sin (e+f x) (g \tan (e+f x))^{1+p}}{f g (2+p)}+\frac{b^2 \, _2F_1\left (2,\frac{3+p}{2};\frac{5+p}{2};-\tan ^2(e+f x)\right ) (g \tan (e+f x))^{3+p}}{f g^3 (3+p)}\\ \end{align*}

Mathematica [C]  time = 14.2085, size = 2464, normalized size = 13.25 \[ \text{Result too large to show} \]

Warning: Unable to verify antiderivative.

[In]

Integrate[(a + b*Sin[e + f*x])^2*(g*Tan[e + f*x])^p,x]

[Out]

(2*(Cos[e + f*x]*Sec[(e + f*x)/2]^2)^p*Tan[(e + f*x)/2]*(a^2*(2 + p)*AppellF1[(1 + p)/2, p, 1, (3 + p)/2, Tan[
(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 4*b*(b*(2 + p)*AppellF1[(1 + p)/2, p, 2, (3 + p)/2, Tan[(e + f*x)/2]^2,
 -Tan[(e + f*x)/2]^2] - b*(2 + p)*AppellF1[(1 + p)/2, p, 3, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2
] + a*(1 + p)*AppellF1[1 + p/2, p, 2, 2 + p/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Tan[(e + f*x)/2]))*(g*
Tan[e + f*x])^p*(-(b^2*Cos[2*(e + f*x)]^3*Tan[e + f*x]^p)/4 + (I/4)*b^2*Sin[2*(e + f*x)]*Tan[e + f*x]^p + I*a^
2*Sin[e + f*x]^2*Sin[2*(e + f*x)]*Tan[e + f*x]^p + (b^2*Sin[2*(e + f*x)]^2*Tan[e + f*x]^p)/2 - (I/4)*b^2*Sin[2
*(e + f*x)]^3*Tan[e + f*x]^p + Cos[e + f*x]^2*(a^2*Cos[2*(e + f*x)]*Tan[e + f*x]^p - I*a^2*Sin[2*(e + f*x)]*Ta
n[e + f*x]^p) + Cos[2*(e + f*x)]^2*((b^2*Tan[e + f*x]^p)/2 + a*b*Sin[e + f*x]*Tan[e + f*x]^p - (I/4)*b^2*Sin[2
*(e + f*x)]*Tan[e + f*x]^p) + Sin[e + f*x]*(I*a*b*Sin[2*(e + f*x)]*Tan[e + f*x]^p + a*b*Sin[2*(e + f*x)]^2*Tan
[e + f*x]^p) + Cos[2*(e + f*x)]*(-(b^2*Tan[e + f*x]^p)/4 - a*b*Sin[e + f*x]*Tan[e + f*x]^p - a^2*Sin[e + f*x]^
2*Tan[e + f*x]^p - (b^2*Sin[2*(e + f*x)]^2*Tan[e + f*x]^p)/4) + Cos[e + f*x]*((-I)*a*b*Cos[2*(e + f*x)]^2*Tan[
e + f*x]^p + a*b*Sin[2*(e + f*x)]*Tan[e + f*x]^p + 2*a^2*Sin[e + f*x]*Sin[2*(e + f*x)]*Tan[e + f*x]^p - I*a*b*
Sin[2*(e + f*x)]^2*Tan[e + f*x]^p + Cos[2*(e + f*x)]*(I*a*b*Tan[e + f*x]^p + (2*I)*a^2*Sin[e + f*x]*Tan[e + f*
x]^p))))/(f*(1 + p)*(2 + p)*((2*p*(Cos[e + f*x]*Sec[(e + f*x)/2]^2)^p*Sec[e + f*x]^2*Tan[(e + f*x)/2]*(a^2*(2
+ p)*AppellF1[(1 + p)/2, p, 1, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 4*b*(b*(2 + p)*AppellF1[(
1 + p)/2, p, 2, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] - b*(2 + p)*AppellF1[(1 + p)/2, p, 3, (3 +
 p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + a*(1 + p)*AppellF1[1 + p/2, p, 2, 2 + p/2, Tan[(e + f*x)/2]^
2, -Tan[(e + f*x)/2]^2]*Tan[(e + f*x)/2]))*Tan[e + f*x]^(-1 + p))/((1 + p)*(2 + p)) + (Sec[(e + f*x)/2]^2*(Cos
[e + f*x]*Sec[(e + f*x)/2]^2)^p*(a^2*(2 + p)*AppellF1[(1 + p)/2, p, 1, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e
+ f*x)/2]^2] + 4*b*(b*(2 + p)*AppellF1[(1 + p)/2, p, 2, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] -
b*(2 + p)*AppellF1[(1 + p)/2, p, 3, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] + a*(1 + p)*AppellF1[1
 + p/2, p, 2, 2 + p/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Tan[(e + f*x)/2]))*Tan[e + f*x]^p)/((1 + p)*(2
 + p)) + (2*p*(Cos[e + f*x]*Sec[(e + f*x)/2]^2)^(-1 + p)*Tan[(e + f*x)/2]*(-(Sec[(e + f*x)/2]^2*Sin[e + f*x])
+ Cos[e + f*x]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])*(a^2*(2 + p)*AppellF1[(1 + p)/2, p, 1, (3 + p)/2, Tan[(e +
 f*x)/2]^2, -Tan[(e + f*x)/2]^2] + 4*b*(b*(2 + p)*AppellF1[(1 + p)/2, p, 2, (3 + p)/2, Tan[(e + f*x)/2]^2, -Ta
n[(e + f*x)/2]^2] - b*(2 + p)*AppellF1[(1 + p)/2, p, 3, (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2] +
a*(1 + p)*AppellF1[1 + p/2, p, 2, 2 + p/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Tan[(e + f*x)/2]))*Tan[e +
 f*x]^p)/((1 + p)*(2 + p)) + (2*(Cos[e + f*x]*Sec[(e + f*x)/2]^2)^p*Tan[(e + f*x)/2]*(a^2*(2 + p)*(-(((1 + p)*
AppellF1[1 + (1 + p)/2, p, 2, 1 + (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(
e + f*x)/2])/(3 + p)) + (p*(1 + p)*AppellF1[1 + (1 + p)/2, 1 + p, 1, 1 + (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(
e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/(3 + p)) + 4*b*((a*(1 + p)*AppellF1[1 + p/2, p, 2, 2 + p/2
, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2)/2 + a*(1 + p)*Tan[(e + f*x)/2]*((-2*(1 + p/2)*A
ppellF1[2 + p/2, p, 3, 3 + p/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/
(2 + p/2) + ((1 + p/2)*p*AppellF1[2 + p/2, 1 + p, 2, 3 + p/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e
+ f*x)/2]^2*Tan[(e + f*x)/2])/(2 + p/2)) + b*(2 + p)*((-2*(1 + p)*AppellF1[1 + (1 + p)/2, p, 3, 1 + (3 + p)/2,
 Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/(3 + p) + (p*(1 + p)*AppellF1[1
 + (1 + p)/2, 1 + p, 2, 1 + (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*
x)/2])/(3 + p)) - b*(2 + p)*((-3*(1 + p)*AppellF1[1 + (1 + p)/2, p, 4, 1 + (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan
[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/(3 + p) + (p*(1 + p)*AppellF1[1 + (1 + p)/2, 1 + p, 3, 1
 + (3 + p)/2, Tan[(e + f*x)/2]^2, -Tan[(e + f*x)/2]^2]*Sec[(e + f*x)/2]^2*Tan[(e + f*x)/2])/(3 + p))))*Tan[e +
 f*x]^p)/((1 + p)*(2 + p))))

________________________________________________________________________________________

Maple [F]  time = 1.446, size = 0, normalized size = 0. \begin{align*} \int \left ( a+b\sin \left ( fx+e \right ) \right ) ^{2} \left ( g\tan \left ( fx+e \right ) \right ) ^{p}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sin(f*x+e))^2*(g*tan(f*x+e))^p,x)

[Out]

int((a+b*sin(f*x+e))^2*(g*tan(f*x+e))^p,x)

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (b \sin \left (f x + e\right ) + a\right )}^{2} \left (g \tan \left (f x + e\right )\right )^{p}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^2*(g*tan(f*x+e))^p,x, algorithm="maxima")

[Out]

integrate((b*sin(f*x + e) + a)^2*(g*tan(f*x + e))^p, x)

________________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left (-{\left (b^{2} \cos \left (f x + e\right )^{2} - 2 \, a b \sin \left (f x + e\right ) - a^{2} - b^{2}\right )} \left (g \tan \left (f x + e\right )\right )^{p}, x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^2*(g*tan(f*x+e))^p,x, algorithm="fricas")

[Out]

integral(-(b^2*cos(f*x + e)^2 - 2*a*b*sin(f*x + e) - a^2 - b^2)*(g*tan(f*x + e))^p, x)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (g \tan{\left (e + f x \right )}\right )^{p} \left (a + b \sin{\left (e + f x \right )}\right )^{2}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))**2*(g*tan(f*x+e))**p,x)

[Out]

Integral((g*tan(e + f*x))**p*(a + b*sin(e + f*x))**2, x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (b \sin \left (f x + e\right ) + a\right )}^{2} \left (g \tan \left (f x + e\right )\right )^{p}\,{d x} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(f*x+e))^2*(g*tan(f*x+e))^p,x, algorithm="giac")

[Out]

integrate((b*sin(f*x + e) + a)^2*(g*tan(f*x + e))^p, x)